<template>
  <div class="q-px-lg q-pt-md q-pb-xl">
    <t-slider
      v-model="model"
      :min="0"
      :max="6"
      label="滑块11"
      marker-labels
	  :markerStep="1"
      :showLabel="true"
      popLabelPosition="top"
      :labelValue="model + '%'"
    />

    <t-slider
      v-model="model"
      color="rgba(244,0,0,0.3)"
      showLabel
      markers
      labelAlways
      label-title="滑块1"
      pop-label-position="bottom"
      marker-position="top"
      :marker-labels="fnMarkerLabel"
      :min="0"
      :max="6"
    />

    <t-slider
      v-model="model"
      color="purple"
      label="滑块22"
      showLabel
      labelAlways
      markers
      :marker-labels="objMarkerLabel"
      :min="0"
      :max="6"
    />

    <t-slider
      v-model="priceModel"
      color="green"
      :inner-min="3"
      :inner-max="6"
      markers
      :marker-labels="arrayMarkerLabel"
      label-always
      :label-value="priceLabel"
      switch-label-side
      switch-marker-labels-side
      :min="2"
      :max="7"
    />
  </div>
</template>

<script>
  import { computed, ref } from 'vue';

  export default {
    setup() {
      const model = ref(2);
      const priceModel = ref(4);

      return {
        model,
        fnMarkerLabel: val => `${10 * val}%`,
        objMarkerLabel: { 0: '0°C', 3: { label: '3°C' }, 5: '5°C', 6: '6°C' },

        priceModel,
        priceLabel: computed(() => `$ ${priceModel.value}`),
        arrayMarkerLabel: [
          { value: 3, label: '$3' },
          { value: 4, label: '$4' },
          { value: 5, label: '$5' },
          { value: 6, label: '$6' },
        ],
      };
    },
  };
</script>

